import { getQuestionListApi } from '../../api/audit/index'
import qs from 'qs'
export const state = () => ({
  tableData: [],
  index: 0,
  randomSize:20,
  totalTime:20//minutes

})

export const mutations = {
  SET_LIST(state, tableData) {
    state.tableData = tableData
  },
  SET_INDEX(state,index){
    state.index=index
  }

}

export const actions = {
  // 渲染列表
  async getQuestionList({ commit }) {
    const r = await getQuestionListApi()
    // console.log(r.data);
    commit('SET_LIST', r.data)


  }
}
export const getters = {
  handelOptions(state) {
    return state.tableData && {
      ...state.tableData[state.index],
      options: JSON.parse(state.tableData[state.index].options),
      answers: JSON.parse(state.tableData[state.index].answers)
    }

  }
}

